package com.breakfast.fun.data.entity.user.submit;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by yukai on 16/9/22.
 */

public class OrderInfo {

    /**
     * total : 0
     * pageTotal : 0
     * data : {"totalPrice":9,"freePrice":0,"orderNo":"F201609221721115407","orderId":57675,"goodsCount":1,"accountMoney":213.55,"orderTime":"2016-09-22 17:21:11"}
     * msg : 订单提交成功
     * success : true
     */

    private int total;
    private int pageTotal;
    /**
     * totalPrice : 9.0
     * freePrice : 0
     * orderNo : F201609221721115407
     * orderId : 57675
     * goodsCount : 1
     * accountMoney : 213.55
     * orderTime : 2016-09-22 17:21:11
     */

    private OrderInfoData data;
    private String msg;
    private boolean success;

    public static OrderInfo objectFromData(String str) {

        return new Gson().fromJson(str, OrderInfo.class);
    }

    public static List<OrderInfo> arrayOrderInfoFromData(String str) {

        Type listType = new TypeToken<ArrayList<OrderInfo>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
    }

    public OrderInfoData getData() {
        return data;
    }

    public void setData(OrderInfoData data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

}
